<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>perlgit - Detailed information about git and the Perl repository - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/perlgit">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="perlgit.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/perlgit">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/perlgit">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/perlgit">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/perlgit">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/perlgit">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/perlgit">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/perlgit">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/perlgit">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/perlgit">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/perlgit">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/perlgit">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/perlgit">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/perlgit">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/perlgit">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/perlgit">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/perlgit">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/perlgit">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/perlgit">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/perlgit">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/perlgit">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/perlgit">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/perlgit">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/perlgit">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/perlgit">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/perlgit">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/perlgit">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/perlgit">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/perlgit">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/perlgit">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/perlgit">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/perlgit">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/perlgit">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/perlgit">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/perlgit">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/perlgit">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/perlgit">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/perlgit">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/perlgit">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/perlgit">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/perlgit">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/perlgit">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/perlgit">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/perlgit">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/perlgit">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/perlgit">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/perlgit">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/perlgit">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/perlgit">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/perlgit">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/perlgit">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/perlgit">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/perlgit">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/perlgit">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/perlgit">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/perlgit">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/perlgit">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/perlgit">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/perlgit">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/perlgit">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/perlgit">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/perlgit">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/perlgit">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/perlgit">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/perlgit">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/perlgit">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/perlgit">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/perlgit">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/perlgit">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/perlgit">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/perlgit">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/perlgit">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/perlgit">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/perlgit">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/perlgit">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/perlgit">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/perlgit">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/perlgit">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/perlgit">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/perlgit">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/perlgit">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="perlgit.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/perlgit">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/perlgit">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/perlgit">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/perlgit">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/perlgit">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/perlgit">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/perlgit">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/perlgit">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/perlgit">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/perlgit">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/perlgit">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/perlgit">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/perlgit">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/perlgit">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/perlgit">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/perlgit">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/perlgit">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/perlgit">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/perlgit">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/perlgit">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/perlgit">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/perlgit">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/perlgit">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/perlgit">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/perlgit">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/perlgit">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/perlgit">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/perlgit">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/perlgit">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/perlgit">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/perlgit">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/perlgit">5.35.1</a>
          <a class="dropdown-item active" href="perlgit.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="perlgit.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="perlgit.html">perlgit</a>
          <div id="more">
            (<a href="perlgit.txt">source</a>,
            <a href="https://metacpan.org/pod/perlgit">CPAN</a>)
          </div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="perlgit.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#CLONING-THE-REPOSITORY">CLONING THE REPOSITORY</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#WORKING-WITH-THE-REPOSITORY">WORKING WITH THE REPOSITORY</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Finding-out-your-status">Finding out your status</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Patch-workflow">Patch workflow</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#A-note-on-derived-files">A note on derived files</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Cleaning-a-working-directory">Cleaning a working directory</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Bisecting">Bisecting</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Topic-branches-and-rewriting-history">Topic branches and rewriting history</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Grafts">Grafts</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#WRITE-ACCESS-TO-THE-GIT-REPOSITORY">WRITE ACCESS TO THE GIT REPOSITORY</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Working-with-Github-pull-requests">Working with Github pull requests</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Accepting-a-patch">Accepting a patch</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Committing-to-blead">Committing to blead</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#On-merging-and-rebasing">On merging and rebasing</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Committing-to-maintenance-versions">Committing to maintenance versions</a>
              </li>
              <li>
                <a class="text-decoration-none" href="perlgit.html#Using-a-smoke-me-branch-to-test-changes">Using a smoke-me branch to test changes</a>
              </li>
          </ul>

              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="perlgit.html#NAME">#</a>NAME</h1>

<p>perlgit - Detailed information about git and the Perl repository</p>

<h1 id="DESCRIPTION"><a class="permalink" href="perlgit.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>This document provides details on using git to develop Perl. If you are just interested in working on a quick patch, see <a href="perlhack.html">perlhack</a> first. This document is intended for people who are regular contributors to Perl, including those with write access to the git repository.</p>

<h1 id="CLONING-THE-REPOSITORY"><a class="permalink" href="perlgit.html#CLONING-THE-REPOSITORY">#</a><a id="CLONING"></a>CLONING THE REPOSITORY</h1>

<p>All of Perl&#39;s source code is kept centrally in a Git repository at <i>github.com</i>.</p>

<p>You can make a read-only clone of the repository by running:</p>

<pre><code class="plaintext">% git clone git://github.com/Perl/perl5.git perl</code></pre>

<p>This uses the git protocol (port 9418).</p>

<p>If you cannot use the git protocol for firewall reasons, you can also clone via http:</p>

<pre><code class="plaintext">% git clone https://github.com/Perl/perl5.git perl</code></pre>

<h1 id="WORKING-WITH-THE-REPOSITORY"><a class="permalink" href="perlgit.html#WORKING-WITH-THE-REPOSITORY">#</a><a id="WORKING"></a>WORKING WITH THE REPOSITORY</h1>

<p>Once you have changed into the repository directory, you can inspect it. After a clone the repository will contain a single local branch, which will be the current branch as well, as indicated by the asterisk.</p>

<pre><code class="plaintext">% git branch
* blead</code></pre>

<p>Using the -a switch to <code>branch</code> will also show the remote tracking branches in the repository:</p>

<pre><code class="plaintext">% git branch -a
* blead
  origin/HEAD
  origin/blead
...</code></pre>

<p>The branches that begin with &quot;origin&quot; correspond to the &quot;git remote&quot; that you cloned from (which is named &quot;origin&quot;). Each branch on the remote will be exactly tracked by these branches. You should NEVER do work on these remote tracking branches. You only ever do work in a local branch. Local branches can be configured to automerge (on pull) from a designated remote tracking branch. This is the case with the default branch <code>blead</code> which will be configured to merge from the remote tracking branch <code>origin/blead</code>.</p>

<p>You can see recent commits:</p>

<pre><code class="plaintext">% git log</code></pre>

<p>And pull new changes from the repository, and update your local repository (must be clean first)</p>

<pre><code class="plaintext">% git pull</code></pre>

<p>Assuming we are on the branch <code>blead</code> immediately after a pull, this command would be more or less equivalent to:</p>

<pre><code class="plaintext">% git fetch
% git merge origin/blead</code></pre>

<p>In fact if you want to update your local repository without touching your working directory you do:</p>

<pre><code class="plaintext">% git fetch</code></pre>

<p>And if you want to update your remote-tracking branches for all defined remotes simultaneously you can do</p>

<pre><code class="plaintext">% git remote update</code></pre>

<p>Neither of these last two commands will update your working directory, however both will update the remote-tracking branches in your repository.</p>

<p>To make a local branch of a remote branch:</p>

<pre><code class="plaintext">% git checkout -b maint-5.10 origin/maint-5.10</code></pre>

<p>To switch back to blead:</p>

<pre><code class="plaintext">% git checkout blead</code></pre>

<h2 id="Finding-out-your-status"><a class="permalink" href="perlgit.html#Finding-out-your-status">#</a><a id="Finding"></a>Finding out your status</h2>

<p>The most common git command you will use will probably be</p>

<pre><code class="plaintext">% git status</code></pre>

<p>This command will produce as output a description of the current state of the repository, including modified files and unignored untracked files, and in addition it will show things like what files have been staged for the next commit, and usually some useful information about how to change things. For instance the following:</p>

<pre><code class="plaintext">% git status
On branch blead
Your branch is ahead of &#39;origin/blead&#39; by 1 commit.

Changes to be committed:
  (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage)

      modified:   pod/perlgit.pod

Changes not staged for commit:
  (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)
  (use &quot;git checkout -- &lt;file&gt;...&quot; to discard changes in working
                                                             directory)

      modified:   pod/perlgit.pod

Untracked files:
  (use &quot;git add &lt;file&gt;...&quot; to include in what will be committed)

      deliberate.untracked</code></pre>

<p>This shows that there were changes to this document staged for commit, and that there were further changes in the working directory not yet staged. It also shows that there was an untracked file in the working directory, and as you can see shows how to change all of this. It also shows that there is one commit on the working branch <code>blead</code> which has not been pushed to the <code>origin</code> remote yet. <b>NOTE</b>: This output is also what you see as a template if you do not provide a message to <code>git commit</code>.</p>

<h2 id="Patch-workflow"><a class="permalink" href="perlgit.html#Patch-workflow">#</a><a id="Patch"></a>Patch workflow</h2>

<p>First, please read <a href="perlhack.html">perlhack</a> for details on hacking the Perl core. That document covers many details on how to create a good patch.</p>

<p>If you already have a Perl repository, you should ensure that you&#39;re on the <i>blead</i> branch, and your repository is up to date:</p>

<pre><code class="plaintext">% git checkout blead
% git pull</code></pre>

<p>It&#39;s preferable to patch against the latest blead version, since this is where new development occurs for all changes other than critical bug fixes. Critical bug fix patches should be made against the relevant maint branches, or should be submitted with a note indicating all the branches where the fix should be applied.</p>

<p>Now that we have everything up to date, we need to create a temporary new branch for these changes and switch into it:</p>

<pre><code class="plaintext">% git checkout -b orange</code></pre>

<p>which is the short form of</p>

<pre><code class="plaintext">% git branch orange
% git checkout orange</code></pre>

<p>Creating a topic branch makes it easier for the maintainers to rebase or merge back into the master blead for a more linear history. If you don&#39;t work on a topic branch the maintainer has to manually cherry pick your changes onto blead before they can be applied.</p>

<p>That&#39;ll get you scolded on perl5-porters, so don&#39;t do that. Be Awesome.</p>

<p>Then make your changes. For example, if Leon Brocard changes his name to Orange Brocard, we should change his name in the AUTHORS file:</p>

<pre><code class="plaintext">% perl -pi -e &#39;s{Leon Brocard}{Orange Brocard}&#39; AUTHORS</code></pre>

<p>You can see what files are changed:</p>

<pre><code class="plaintext">% git status
On branch orange
Changes to be committed:
  (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage)

   modified:   AUTHORS</code></pre>

<p>And you can see the changes:</p>

<pre><code>% git diff
diff --git a/AUTHORS b/AUTHORS
index 293dd70..722c93e 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -541,7 +541,7 @@    Lars Hecking              &lt;lhecking@nmrc.ucc.ie&gt;
 Laszlo Molnar                  &lt;laszlo.molnar@eth.ericsson.se&gt;
 Leif Huhn                      &lt;leif@hale.dkstat.com&gt;
 Len Johnson                    &lt;lenjay@ibm.net&gt;
-Leon Brocard                   &lt;acme@astray.com&gt;
+Orange Brocard                 &lt;acme@astray.com&gt;
 Les Peters                     &lt;lpeters@aol.net&gt;
 Lesley Binks                   &lt;lesley.binks@gmail.com&gt;
 Lincoln D. Stein               &lt;lstein@cshl.org&gt;</code></pre>

<p>Now commit your change locally:</p>

<pre><code class="plaintext">% git commit -a -m &#39;Rename Leon Brocard to Orange Brocard&#39;
Created commit 6196c1d: Rename Leon Brocard to Orange Brocard
 1 files changed, 1 insertions(+), 1 deletions(-)</code></pre>

<p>The <code>-a</code> option is used to include all files that git tracks that you have changed. If at this time, you only want to commit some of the files you have worked on, you can omit the <code>-a</code> and use the command <code><span style="white-space: nowrap;">git add <i>FILE ...</i></span></code> before doing the commit. <code><span style="white-space: nowrap;">git add --interactive</span></code> allows you to even just commit portions of files instead of all the changes in them.</p>

<p>The <code>-m</code> option is used to specify the commit message. If you omit it, git will open a text editor for you to compose the message interactively. This is useful when the changes are more complex than the sample given here, and, depending on the editor, to know that the first line of the commit message doesn&#39;t exceed the 50 character legal maximum. See <a href="perlhack.html#Commit-message">&quot;Commit message&quot; in perlhack</a> for more information about what makes a good commit message.</p>

<p>Once you&#39;ve finished writing your commit message and exited your editor, git will write your change to disk and tell you something like this:</p>

<pre><code class="plaintext">Created commit daf8e63: explain git status and stuff about remotes
 1 files changed, 83 insertions(+), 3 deletions(-)</code></pre>

<p>If you re-run <code>git status</code>, you should see something like this:</p>

<pre><code class="plaintext">% git status
On branch orange
Untracked files:
  (use &quot;git add &lt;file&gt;...&quot; to include in what will be committed)

      deliberate.untracked

nothing added to commit but untracked files present (use &quot;git add&quot; to
                                                                 track)</code></pre>

<p>When in doubt, before you do anything else, check your status and read it carefully, many questions are answered directly by the git status output.</p>

<p>You can examine your last commit with:</p>

<pre><code class="plaintext">% git show HEAD</code></pre>

<p>and if you are not happy with either the description or the patch itself you can fix it up by editing the files once more and then issue:</p>

<pre><code class="plaintext">% git commit -a --amend</code></pre>

<p>Now, create a fork on GitHub to push your branch to, and add it as a remote if you haven&#39;t already, as described in the GitHub documentation at <a href="https://help.github.com/en/articles/working-with-forks">https://help.github.com/en/articles/working-with-forks</a>:</p>

<pre><code>% git remote add fork git@github.com:MyUser/perl5.git</code></pre>

<p>And push the branch to your fork:</p>

<pre><code class="plaintext">% git push -u fork orange</code></pre>

<p>You should now submit a Pull Request (PR) on GitHub from the new branch to blead. For more information, see the GitHub documentation at <a href="https://help.github.com/en/articles/creating-a-pull-request-from-a-fork">https://help.github.com/en/articles/creating-a-pull-request-from-a-fork</a>.</p>

<p>You can also send patch files to <a href="mailto:perl5-porters@perl.org">perl5-porters@perl.org</a> directly if the patch is not ready to be applied, but intended for discussion.</p>

<p>To create a patch file for all your local changes:</p>

<pre><code class="plaintext">% git format-patch -M blead..
0001-Rename-Leon-Brocard-to-Orange-Brocard.patch</code></pre>

<p>Or for a lot of changes, e.g. from a topic branch:</p>

<pre><code class="plaintext">% git format-patch --stdout -M blead.. &gt; topic-branch-changes.patch</code></pre>

<p>If you want to delete your temporary branch, you may do so with:</p>

<pre><code class="plaintext">% git checkout blead
% git branch -d orange
error: The branch &#39;orange&#39; is not an ancestor of your current HEAD.
If you are sure you want to delete it, run &#39;git branch -D orange&#39;.
% git branch -D orange
Deleted branch orange.</code></pre>

<h2 id="A-note-on-derived-files"><a class="permalink" href="perlgit.html#A-note-on-derived-files">#</a><a id="A"></a>A note on derived files</h2>

<p>Be aware that many files in the distribution are derivative--avoid patching them, because git won&#39;t see the changes to them, and the build process will overwrite them. Patch the originals instead. Most utilities (like perldoc) are in this category, i.e. patch <i>utils/perldoc.PL</i> rather than <i>utils/perldoc</i>. Similarly, don&#39;t create patches for files under <i>$src_root/ext</i> from their copies found in <i>$install_root/lib</i>. If you are unsure about the proper location of a file that may have gotten copied while building the source distribution, consult the <i>MANIFEST</i>.</p>

<h2 id="Cleaning-a-working-directory"><a class="permalink" href="perlgit.html#Cleaning-a-working-directory">#</a><a id="Cleaning"></a>Cleaning a working directory</h2>

<p>The command <code>git clean</code> can with varying arguments be used as a replacement for <code>make clean</code>.</p>

<p>To reset your working directory to a pristine condition you can do:</p>

<pre><code class="plaintext">% git clean -dxf</code></pre>

<p>However, be aware this will delete ALL untracked content. You can use</p>

<pre><code class="plaintext">% git clean -Xf</code></pre>

<p>to remove all ignored untracked files, such as build and test byproduct, but leave any manually created files alone.</p>

<p>If you only want to cancel some uncommitted edits, you can use <code>git checkout</code> and give it a list of files to be reverted, or <code>git checkout -f</code> to revert them all.</p>

<p>If you want to cancel one or several commits, you can use <code>git reset</code>.</p>

<h2 id="Bisecting"><a class="permalink" href="perlgit.html#Bisecting">#</a>Bisecting</h2>

<p><code>git</code> provides a built-in way to determine which commit should be blamed for introducing a given bug. <code>git bisect</code> performs a binary search of history to locate the first failing commit. It is fast, powerful and flexible, but requires some setup and to automate the process an auxiliary shell script is needed.</p>

<p>The core provides a wrapper program, <i>Porting/bisect.pl</i>, which attempts to simplify as much as possible, making bisecting as simple as running a Perl one-liner. For example, if you want to know when this became an error:</p>

<pre><code>perl -e &#39;my $a := 2&#39;</code></pre>

<p>you simply run this:</p>

<pre><code>.../Porting/bisect.pl -e &#39;my $a := 2;&#39;</code></pre>

<p>Using <i>Porting/bisect.pl</i>, with one command (and no other files) it&#39;s easy to find out</p>

<ul>

<li><p>Which commit caused this example code to break?</p>

</li>
<li><p>Which commit caused this example code to start working?</p>

</li>
<li><p>Which commit added the first file to match this regex?</p>

</li>
<li><p>Which commit removed the last file to match this regex?</p>

</li>
</ul>

<p>usually without needing to know which versions of perl to use as start and end revisions, as <i>Porting/bisect.pl</i> automatically searches to find the earliest stable version for which the test case passes. Run <code>Porting/bisect.pl --help</code> for the full documentation, including how to set the <code>Configure</code> and build time options.</p>

<p>If you require more flexibility than <i>Porting/bisect.pl</i> has to offer, you&#39;ll need to run <code>git bisect</code> yourself. It&#39;s most useful to use <code>git bisect run</code> to automate the building and testing of perl revisions. For this you&#39;ll need a shell script for <code>git</code> to call to test a particular revision. An example script is <i>Porting/bisect-example.sh</i>, which you should copy <b>outside</b> of the repository, as the bisect process will reset the state to a clean checkout as it runs. The instructions below assume that you copied it as <i>~/run</i> and then edited it as appropriate.</p>

<p>You first enter in bisect mode with:</p>

<pre><code class="plaintext">% git bisect start</code></pre>

<p>For example, if the bug is present on <code>HEAD</code> but wasn&#39;t in 5.10.0, <code>git</code> will learn about this when you enter:</p>

<pre><code class="plaintext">% git bisect bad
% git bisect good perl-5.10.0
Bisecting: 853 revisions left to test after this</code></pre>

<p>This results in checking out the median commit between <code>HEAD</code> and <code>perl-5.10.0</code>. You can then run the bisecting process with:</p>

<pre><code class="plaintext">% git bisect run ~/run</code></pre>

<p>When the first bad commit is isolated, <code>git bisect</code> will tell you so:</p>

<pre><code>ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5 is first bad commit
commit ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5
Author: Dave Mitchell &lt;davem@fdisolutions.com&gt;
Date:   Sat Feb 9 14:56:23 2008 +0000

    [perl #49472] Attributes + Unknown Error
    ...

bisect run success</code></pre>

<p>You can peek into the bisecting process with <code>git bisect log</code> and <code>git bisect visualize</code>. <code>git bisect reset</code> will get you out of bisect mode.</p>

<p>Please note that the first <code>good</code> state must be an ancestor of the first <code>bad</code> state. If you want to search for the commit that <i>solved</i> some bug, you have to negate your test case (i.e. exit with <code>1</code> if OK and <code>0</code> if not) and still mark the lower bound as <code>good</code> and the upper as <code>bad</code>. The &quot;first bad commit&quot; has then to be understood as the &quot;first commit where the bug is solved&quot;.</p>

<p><code>git help bisect</code> has much more information on how you can tweak your binary searches.</p>

<p>Following bisection you may wish to configure, build and test perl at commits identified by the bisection process. Sometimes, particularly with older perls, <code>make</code> may fail during this process. In this case you may be able to patch the source code at the older commit point. To do so, please follow the suggestions provided in <a href="perlhack.html#Building-perl-at-older-commits">&quot;Building perl at older commits&quot; in perlhack</a>.</p>

<h2 id="Topic-branches-and-rewriting-history"><a class="permalink" href="perlgit.html#Topic-branches-and-rewriting-history">#</a><a id="Topic"></a>Topic branches and rewriting history</h2>

<p>Individual committers should create topic branches under <b>yourname</b>/<b>some_descriptive_name</b>:</p>

<pre><code>% branch=&quot;$yourname/$some_descriptive_name&quot;
% git checkout -b $branch
... do local edits, commits etc ...
% git push origin -u $branch</code></pre>

<p>Should you be stuck with an ancient version of git (prior to 1.7), then <code>git push</code> will not have the <code>-u</code> switch, and you have to replace the last step with the following sequence:</p>

<pre><code>% git push origin $branch:refs/heads/$branch
% git config branch.$branch.remote origin
% git config branch.$branch.merge refs/heads/$branch</code></pre>

<p>If you want to make changes to someone else&#39;s topic branch, you should check with its creator before making any change to it.</p>

<p>You might sometimes find that the original author has edited the branch&#39;s history. There are lots of good reasons for this. Sometimes, an author might simply be rebasing the branch onto a newer source point. Sometimes, an author might have found an error in an early commit which they wanted to fix before merging the branch to blead.</p>

<p>Currently the master repository is configured to forbid non-fast-forward merges. This means that the branches within can not be rebased and pushed as a single step.</p>

<p>The only way you will ever be allowed to rebase or modify the history of a pushed branch is to delete it and push it as a new branch under the same name. Please think carefully about doing this. It may be better to sequentially rename your branches so that it is easier for others working with you to cherry-pick their local changes onto the new version. (XXX: needs explanation).</p>

<p>If you want to rebase a personal topic branch, you will have to delete your existing topic branch and push as a new version of it. You can do this via the following formula (see the explanation about <code>refspec</code>&#39;s in the git push documentation for details) after you have rebased your branch:</p>

<pre><code># first rebase
% git checkout $user/$topic
% git fetch
% git rebase origin/blead

# then &quot;delete-and-push&quot;
% git push origin :$user/$topic
% git push origin $user/$topic</code></pre>

<p><b>NOTE:</b> it is forbidden at the repository level to delete any of the &quot;primary&quot; branches. That is any branch matching <code>m!^(blead|maint|perl)!</code>. Any attempt to do so will result in git producing an error like this:</p>

<pre><code class="plaintext">% git push origin :blead
*** It is forbidden to delete blead/maint branches in this repository
error: hooks/update exited with error code 1
error: hook declined to update refs/heads/blead
To ssh://perl5.git.perl.org/perl
 ! [remote rejected] blead (hook declined)
 error: failed to push some refs to &#39;ssh://perl5.git.perl.org/perl&#39;</code></pre>

<p>As a matter of policy we do <b>not</b> edit the history of the blead and maint-* branches. If a typo (or worse) sneaks into a commit to blead or maint-*, we&#39;ll fix it in another commit. The only types of updates allowed on these branches are &quot;fast-forwards&quot;, where all history is preserved.</p>

<p>Annotated tags in the canonical perl.git repository will never be deleted or modified. Think long and hard about whether you want to push a local tag to perl.git before doing so. (Pushing simple tags is not allowed.)</p>

<h2 id="Grafts"><a class="permalink" href="perlgit.html#Grafts">#</a>Grafts</h2>

<p>The perl history contains one mistake which was not caught in the conversion: a merge was recorded in the history between blead and maint-5.10 where no merge actually occurred. Due to the nature of git, this is now impossible to fix in the public repository. You can remove this mis-merge locally by adding the following line to your <code>.git/info/grafts</code> file:</p>

<pre><code class="plaintext">296f12bbbbaa06de9be9d09d3dcf8f4528898a49 434946e0cb7a32589ed92d18008aaa1d88515930</code></pre>

<p>It is particularly important to have this graft line if any bisecting is done in the area of the &quot;merge&quot; in question.</p>

<h1 id="WRITE-ACCESS-TO-THE-GIT-REPOSITORY"><a class="permalink" href="perlgit.html#WRITE-ACCESS-TO-THE-GIT-REPOSITORY">#</a><a id="WRITE"></a>WRITE ACCESS TO THE GIT REPOSITORY</h1>

<p>Once you have write access, you will need to modify the URL for the origin remote to enable pushing. Edit <i>.git/config</i> with the git-config(1) command:</p>

<pre><code>% git config remote.origin.url git@github.com:Perl/perl5.git</code></pre>

<p>You can also set up your user name and e-mail address. Most people do this once globally in their <i>~/.gitconfig</i> by doing something like:</p>

<pre><code>% git config --global user.name &quot;Ævar Arnfjörð Bjarmason&quot;
% git config --global user.email avarab@gmail.com</code></pre>

<p>However, if you&#39;d like to override that just for perl, execute something like the following in <i>perl</i>:</p>

<pre><code>% git config user.email avar@cpan.org</code></pre>

<p>It is also possible to keep <code>origin</code> as a git remote, and add a new remote for ssh access:</p>

<pre><code>% git remote add camel git@github.com:Perl/perl5.git</code></pre>

<p>This allows you to update your local repository by pulling from <code>origin</code>, which is faster and doesn&#39;t require you to authenticate, and to push your changes back with the <code>camel</code> remote:</p>

<pre><code class="plaintext">% git fetch camel
% git push camel</code></pre>

<p>The <code>fetch</code> command just updates the <code>camel</code> refs, as the objects themselves should have been fetched when pulling from <code>origin</code>.</p>

<h2 id="Working-with-Github-pull-requests"><a class="permalink" href="perlgit.html#Working-with-Github-pull-requests">#</a><a id="Working"></a>Working with Github pull requests</h2>

<p>Pull requests typically originate from outside of the <code>Perl/perl.git</code> repository, so if you want to test or work with it locally a vanilla <code>git fetch</code> from the <code>Perl/perl5.git</code> repository won&#39;t fetch it.</p>

<p>However Github does provide a mechanism to fetch a pull request to a local branch. They are available on Github remotes under <code>pull/</code>, so you can use <code>git fetch pull/<i>PRID</i>/head:<i>localname</i></code> to make a local copy. eg. to fetch pull request 9999 to the local branch <code>local-branch-name</code> run:</p>

<pre><code class="plaintext">git fetch origin pull/9999/head:local-branch-name</code></pre>

<p>and then:</p>

<pre><code class="plaintext">git checkout local-branch-name</code></pre>

<p>Note: this branch is not rebased on <code>blead</code>, so instead of the checkout above, you might want:</p>

<pre><code class="plaintext">git rebase origin/blead local-branch-name</code></pre>

<p>which rebases <code>local-branch-name</code> on <code>blead</code>, and checks it out.</p>

<p>Alternatively you can configure the remote to fetch all pull requests as remote-tracking branches. To do this edit the remote in <i>.git/config</i>, for example if your github remote is <code>origin</code> you&#39;d have:</p>

<pre><code>[remote &quot;origin&quot;]
        url = git@github.com:/Perl/perl5.git
        fetch = +refs/heads/*:refs/remotes/origin/*</code></pre>

<p>Add a line to map the remote pull request branches to remote-tracking branches:</p>

<pre><code>[remote &quot;origin&quot;]
        url = git@github.com:/Perl/perl5.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        fetch = +refs/pull/*/head:refs/remotes/origin/pull/*</code></pre>

<p>and then do a fetch as normal:</p>

<pre><code class="plaintext">git fetch origin</code></pre>

<p>This will create a remote-tracking branch for every pull request, including closed requests.</p>

<p>To remove those remote-tracking branches, remove the line added above and prune:</p>

<pre><code class="plaintext">git fetch -p origin # or git remote prune origin</code></pre>

<h2 id="Accepting-a-patch"><a class="permalink" href="perlgit.html#Accepting-a-patch">#</a><a id="Accepting"></a>Accepting a patch</h2>

<p>If you have received a patch file generated using the above section, you should try out the patch.</p>

<p>First we need to create a temporary new branch for these changes and switch into it:</p>

<pre><code class="plaintext">% git checkout -b experimental</code></pre>

<p>Patches that were formatted by <code>git format-patch</code> are applied with <code>git am</code>:</p>

<pre><code class="plaintext">% git am 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
Applying Rename Leon Brocard to Orange Brocard</code></pre>

<p>Note that some UNIX mail systems can mess with text attachments containing &#39;From &#39;. This will fix them up:</p>

<pre><code class="plaintext">% perl -pi -e&#39;s/^&gt;From /From /&#39; \
                       0001-Rename-Leon-Brocard-to-Orange-Brocard.patch</code></pre>

<p>If just a raw diff is provided, it is also possible use this two-step process:</p>

<pre><code>% git apply bugfix.diff
% git commit -a -m &quot;Some fixing&quot; \
                           --author=&quot;That Guy &lt;that.guy@internets.com&gt;&quot;</code></pre>

<p>Now we can inspect the change:</p>

<pre><code>% git show HEAD
commit b1b3dab48344cff6de4087efca3dbd63548ab5e2
Author: Leon Brocard &lt;acme@astray.com&gt;
Date:   Fri Dec 19 17:02:59 2008 +0000

  Rename Leon Brocard to Orange Brocard

diff --git a/AUTHORS b/AUTHORS
index 293dd70..722c93e 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -541,7 +541,7 @@ Lars Hecking                 &lt;lhecking@nmrc.ucc.ie&gt;
 Laszlo Molnar                  &lt;laszlo.molnar@eth.ericsson.se&gt;
 Leif Huhn                      &lt;leif@hale.dkstat.com&gt;
 Len Johnson                    &lt;lenjay@ibm.net&gt;
-Leon Brocard                   &lt;acme@astray.com&gt;
+Orange Brocard                 &lt;acme@astray.com&gt;
 Les Peters                     &lt;lpeters@aol.net&gt;
 Lesley Binks                   &lt;lesley.binks@gmail.com&gt;
 Lincoln D. Stein               &lt;lstein@cshl.org&gt;</code></pre>

<p>If you are a committer to Perl and you think the patch is good, you can then merge it into blead then push it out to the main repository:</p>

<pre><code class="plaintext">% git checkout blead
% git merge experimental
% git push origin blead</code></pre>

<p>If you want to delete your temporary branch, you may do so with:</p>

<pre><code class="plaintext">% git checkout blead
% git branch -d experimental
error: The branch &#39;experimental&#39; is not an ancestor of your current
HEAD.  If you are sure you want to delete it, run &#39;git branch -D
experimental&#39;.
% git branch -D experimental
Deleted branch experimental.</code></pre>

<h2 id="Committing-to-blead"><a class="permalink" href="perlgit.html#Committing-to-blead">#</a><a id="Committing"></a>Committing to blead</h2>

<p>The &#39;blead&#39; branch will become the next production release of Perl.</p>

<p>Before pushing <i>any</i> local change to blead, it&#39;s incredibly important that you do a few things, lest other committers come after you with pitchforks and torches:</p>

<ul>

<li><p>Make sure you have a good commit message. See <a href="perlhack.html#Commit-message">&quot;Commit message&quot; in perlhack</a> for details.</p>

</li>
<li><p>Run the test suite. You might not think that one typo fix would break a test file. You&#39;d be wrong. Here&#39;s an example of where not running the suite caused problems. A patch was submitted that added a couple of tests to an existing <i>.t</i>. It couldn&#39;t possibly affect anything else, so no need to test beyond the single affected <i>.t</i>, right? But, the submitter&#39;s email address had changed since the last of their submissions, and this caused other tests to fail. Running the test target given in the next item would have caught this problem.</p>

</li>
<li><p>If you don&#39;t run the full test suite, at least <code>make test_porting</code>. This will run basic sanity checks. To see which sanity checks, have a look in <i>t/porting</i>.</p>

</li>
<li><p>If you make any changes that affect miniperl or core routines that have different code paths for miniperl, be sure to run <code>make minitest</code>. This will catch problems that even the full test suite will not catch because it runs a subset of tests under miniperl rather than perl.</p>

</li>
</ul>

<h2 id="On-merging-and-rebasing"><a class="permalink" href="perlgit.html#On-merging-and-rebasing">#</a><a id="On"></a>On merging and rebasing</h2>

<p>Simple, one-off commits pushed to the &#39;blead&#39; branch should be simple commits that apply cleanly. In other words, you should make sure your work is committed against the current position of blead, so that you can push back to the master repository without merging.</p>

<p>Sometimes, blead will move while you&#39;re building or testing your changes. When this happens, your push will be rejected with a message like this:</p>

<pre><code class="plaintext">To ssh://perl5.git.perl.org/perl.git
 ! [rejected]        blead -&gt; blead (non-fast-forward)
error: failed to push some refs to &#39;ssh://perl5.git.perl.org/perl.git&#39;
To prevent you from losing history, non-fast-forward updates were
rejected Merge the remote changes (e.g. &#39;git pull&#39;) before pushing
again.  See the &#39;Note about fast-forwards&#39; section of &#39;git push --help&#39;
for details.</code></pre>

<p>When this happens, you can just <i>rebase</i> your work against the new position of blead, like this (assuming your remote for the master repository is &quot;p5p&quot;):</p>

<pre><code class="plaintext">% git fetch p5p
% git rebase p5p/blead</code></pre>

<p>You will see your commits being re-applied, and you will then be able to push safely. More information about rebasing can be found in the documentation for the git-rebase(1) command.</p>

<p>For larger sets of commits that only make sense together, or that would benefit from a summary of the set&#39;s purpose, you should use a merge commit. You should perform your work on a <a href="perlgit.html#Topic-branches-and-rewriting-history">topic branch</a>, which you should regularly rebase against blead to ensure that your code is not broken by blead moving. When you have finished your work, please perform a final rebase and test. Linear history is something that gets lost with every commit on blead, but a final rebase makes the history linear again, making it easier for future maintainers to see what has happened. Rebase as follows (assuming your work was on the branch <code>committer/somework</code>):</p>

<pre><code class="plaintext">% git checkout committer/somework
% git rebase blead</code></pre>

<p>Then you can merge it into master like this:</p>

<pre><code class="plaintext">% git checkout blead
% git merge --no-ff --no-commit committer/somework
% git commit -a</code></pre>

<p>The switches above deserve explanation. <code>--no-ff</code> indicates that even if all your work can be applied linearly against blead, a merge commit should still be prepared. This ensures that all your work will be shown as a side branch, with all its commits merged into the mainstream blead by the merge commit.</p>

<p><code>--no-commit</code> means that the merge commit will be <i>prepared</i> but not <i>committed</i>. The commit is then actually performed when you run the next command, which will bring up your editor to describe the commit. Without <code>--no-commit</code>, the commit would be made with nearly no useful message, which would greatly diminish the value of the merge commit as a placeholder for the work&#39;s description.</p>

<p>When describing the merge commit, explain the purpose of the branch, and keep in mind that this description will probably be used by the eventual release engineer when reviewing the next perldelta document.</p>

<h2 id="Committing-to-maintenance-versions"><a class="permalink" href="perlgit.html#Committing-to-maintenance-versions">#</a><a id="Committing1"></a>Committing to maintenance versions</h2>

<p>Maintenance versions should only be altered to add critical bug fixes, see <a href="perlpolicy.html">perlpolicy</a>.</p>

<p>To commit to a maintenance version of perl, you need to create a local tracking branch:</p>

<pre><code class="plaintext">% git checkout --track -b maint-5.005 origin/maint-5.005</code></pre>

<p>This creates a local branch named <code>maint-5.005</code>, which tracks the remote branch <code>origin/maint-5.005</code>. Then you can pull, commit, merge and push as before.</p>

<p>You can also cherry-pick commits from blead and another branch, by using the <code>git cherry-pick</code> command. It is recommended to use the <b>-x</b> option to <code>git cherry-pick</code> in order to record the SHA1 of the original commit in the new commit message.</p>

<p>Before pushing any change to a maint version, make sure you&#39;ve satisfied the steps in <a href="perlgit.html#Committing-to-blead">&quot;Committing to blead&quot;</a> above.</p>

<h2 id="Using-a-smoke-me-branch-to-test-changes"><a class="permalink" href="perlgit.html#Using-a-smoke-me-branch-to-test-changes">#</a><a id="Using"></a>Using a smoke-me branch to test changes</h2>

<p>Sometimes a change affects code paths which you cannot test on the OSes which are directly available to you and it would be wise to have users on other OSes test the change before you commit it to blead.</p>

<p>Fortunately, there is a way to get your change smoke-tested on various OSes: push it to a &quot;smoke-me&quot; branch and wait for certain automated smoke-testers to report the results from their OSes. A &quot;smoke-me&quot; branch is identified by the branch name: specifically, as seen on github.com it must be a local branch whose first name component is precisely <code>smoke-me</code>.</p>

<p>The procedure for doing this is roughly as follows (using the example of tonyc&#39;s smoke-me branch called win32stat):</p>

<p>First, make a local branch and switch to it:</p>

<pre><code class="plaintext">% git checkout -b win32stat</code></pre>

<p>Make some changes, build perl and test your changes, then commit them to your local branch. Then push your local branch to a remote smoke-me branch:</p>

<pre><code class="plaintext">% git push origin win32stat:smoke-me/tonyc/win32stat</code></pre>

<p>Now you can switch back to blead locally:</p>

<pre><code class="plaintext">% git checkout blead</code></pre>

<p>and continue working on other things while you wait a day or two, keeping an eye on the results reported for your smoke-me branch at <a href="http://perl.develop-help.com/?b=smoke-me/tonyc/win32state">http://perl.develop-help.com/?b=smoke-me/tonyc/win32state</a>.</p>

<p>If all is well then update your blead branch:</p>

<pre><code class="plaintext">% git pull</code></pre>

<p>then checkout your smoke-me branch once more and rebase it on blead:</p>

<pre><code class="plaintext">% git rebase blead win32stat</code></pre>

<p>Now switch back to blead and merge your smoke-me branch into it:</p>

<pre><code class="plaintext">% git checkout blead
% git merge win32stat</code></pre>

<p>As described earlier, if there are many changes on your smoke-me branch then you should prepare a merge commit in which to give an overview of those changes by using the following command instead of the last command above:</p>

<pre><code class="plaintext">% git merge win32stat --no-ff --no-commit</code></pre>

<p>You should now build perl and test your (merged) changes one last time (ideally run the whole test suite, but failing that at least run the <i>t/porting/*.t</i> tests) before pushing your changes as usual:</p>

<pre><code class="plaintext">% git push origin blead</code></pre>

<p>Finally, you should then delete the remote smoke-me branch:</p>

<pre><code class="plaintext">% git push origin :smoke-me/tonyc/win32stat</code></pre>

<p>(which is likely to produce a warning like this, which can be ignored:</p>

<pre><code class="plaintext">remote: fatal: ambiguous argument
                                 &#39;refs/heads/smoke-me/tonyc/win32stat&#39;:
unknown revision or path not in the working tree.
remote: Use &#39;--&#39; to separate paths from revisions</code></pre>

<p>) and then delete your local branch:</p>

<pre><code class="plaintext">% git branch -d win32stat</code></pre>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
